import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '../views/Home.vue'
import User from '../views/User.vue'
import Main from '../views/main.vue'
import FlowChart from "@/views/flow_chart/FlowChart.vue";


Vue.use(VueRouter)

// 1.创建路由组件

// 2.将组件和路由做一个映射

const myRouters = [
    // 主路由
    {
        path: '/',
        component: Main,
        children: [
            // 子路由
            {

                path: 'home',
                component: Home
            },
            {
                path: 'user',
                component: User
            }
        ]

    },
/*    {path: '/home', component: Home},
    {path: '/user', component: User}*/
    {path: '/flow', component: FlowChart},
    {path: '/flow2', component: ()=>import('../views/flow_chart/Flow2.vue')},
    {path: '/collect', component: ()=>import('../views/flow_chart/CollectionRank.vue')},
]


// 3. 创建 router 实例，对外暴露
export default new VueRouter({
    mode: 'history', // 使用 HTML5 History 模式
    routes: myRouters,
});




